<!DOCTYPE html>
<#assign f = JspTaglibs["http://www.casic304.cn/f"] />
<#assign dicSelect = JspTaglibs["http://www.casic304.cn/dicSelect"]/>
<#assign SourceDept = JspTaglibs["http://www.casic304.cn/SourceDept"]/>
<head>
    <meta charset="utf-8">
    <title>飞行试验管理信息列表</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
    <link rel="stylesheet" href="${ctx}/layui/css/layui.css" media="all"/>
    <link rel="stylesheet" href="${ctx}/qbdmsStatic/iconfont/iconfont.css"/>
    <link rel="stylesheet" href="${ctx}/qbdmsStatic/style/qbdms.css">
    <script type="text/javascript">
        var __ctx = "${ctx}";
    </script>
</head>
<body>

<div style="padding: 6px 16px 16px;">
    <table id="wQbdFlightTestTable" lay-filter="wQbdFlightTestTable"></table>
</div>

<!-- 右侧工具栏 -->
<script type="text/html" id="wQbdFlightTestRightToolsBar">
    <a class="RightBtn" lay-event="particulars">详情</a>
</script>
<script src="${ctx}/qbdmsStatic/public/configFile.js"></script>
<script src="${ctx}/layui/layui.js"></script>
<script>
    //一般直接写在一个js文件中
    layui.config({
        base: serverPath.qbdmsPath + staticPath.qbdmsPath //静态资源所在路径
    }).extend({
        index: 'lib/index' //主入口模块
    }).use(['index', 'table', 'form', 'common', 'publicMethods', 'jquery', 'layer'], function () {
        var table = layui.table;
        var form = layui.form;
        var common = layui.common;
        var publicMethods = layui.publicMethods;
        var $ = layui.jquery;
        var layer = layui.layer;

        var currentSystemLevel = "${currentSystemLevel}";
        var orderCols = [{field: 'sn', type: 'numbers', title: '序号', fixed: 'left'},
            {type: 'checkbox', fixed: 'left'}];
        var fillDeptCols = [];
        if ("GROUPLEVEL" === currentSystemLevel) {
            fillDeptCols = [{field: 'filldeptHospital', title: '数据来源单位', sort: true, sortname: 'filldepthospital',minWidth:'150'}];
        } else if ("HOSPITALLEVEL" === currentSystemLevel) {
            fillDeptCols = [{field: 'filldept', title: '数据来源单位', sort: true, sortname: 'filldept',minWidth:'150'}];
        } else if ("PLANTLEVEL" === currentSystemLevel) {
            fillDeptCols = [{field: 'filldept', title: '数据来源单位', sort: true, sortname: 'filldept',minWidth:'150'}];
        }
        var commonCols= [ //表头
             {field: 'fTestname', title: '试验名称', sort: true, sortname: 'f_testname',minWidth:'110'}
            //如需转换为:yyyy-MM-dd HH:mm:ss: return publicMethods.timeData(d.fLaunchdate,"1");
            //如需转换为HH:mm:ss: return publicMethods.timeData(d.fLaunchdate,"2");
            // 当前转换后的格式为yyyy-MM-dd: return publicMethods.timeData(d.fLaunchdate);
            , {
            field: 'fLaunchdate', title: '发射日期', sort: true, sortname: 'f_launchdate',minWidth:'110',templet: function (d) {
                return publicMethods.timeData(d.fLaunchdate);
            }
        }
            , {field: 'fModelsymbol', title: '型号代号',  sortname: 'f_modelsymbol',minWidth:'110'}
            , {field: 'fModeltype', title: '型号类型', sortname: 'f_modeltype',minWidth:'110'}
            , {field: 'fModeldevelopphase', title: '研制阶段',sortname: 'f_modeldevelopphase',minWidth:'110'}
            , {field: 'fFlightresult', title: '飞行结果',  sortname: 'f_flightresult',minWidth:'110'}
            , {field: 'fTestplace', title: '试验地点', sortname: 'f_testplace',minWidth:'110'}
            , {field: 'fTeststatus', title: '试验情况',  sortname: 'f_teststatus',minWidth:'110'}
            , {field: 'secret', title: '密级', sortname: 'secret',minWidth:'90'}
            , {field: 'fillman', title: '填写人', sortname: 'fillman', hide: true,minWidth:'100'}
            , {field: 'filldate', title: '填写时间', sortname: 'filldate', hide: true,minWidth:'110'}
            /*, {field: 'id', title: '主键', sort: true, sortname: 'id', hide: true}
            , {field: 'fillmanaccount', title: '填写人id', sort: true, sortname: 'f_fillmanaccount', hide: true}
            , {field: 'filldeptid', title: '填写部门id', sort: true, sortname: 'f_filldeptid', hide: true}*/
            , {field: 'fEntrysign', title: '进场标识', sortname: 'f_entrysign', hide: true,minWidth:'110'}
            , {field: 'fFilingnumber', title: '入档编号', sortname: 'f_filingnumber', hide: true,minWidth:'110'}
            , {field: 'fModelnmae', title: '型号名称', sortname: 'f_modelnmae', hide: true,minWidth:'110'}
            , {field: 'fModelbatchno', title: '型号批次', sortname: 'f_modelbatchno', hide: true,minWidth:'110'}
            , {field: 'fTechnicalstatus', title: '技术状态', sortname: 'f_technicalstatus', hide: true,minWidth:'110'}
            , {field: 'fPopulationunit', title: '总体单位', sortname: 'f_populationunit', hide: true,minWidth:'110'}
            , {field: 'fGeneralunit', title: '总装单位',sortname: 'f_generalunit', hide: true,minWidth:'110'}
            , {field: 'fTestcode', title: '试验代号',  sortname: 'f_testcode', hide: true,minWidth:'110'}
            , {field: 'fTestphase', title: '试验性质', sortname: 'f_testphase', hide: true,minWidth:'110'}
            , {field: 'fMissilenumber', title: '导弹编号', sortname: 'f_missilenumber', hide: true,minWidth:'110'}
            //如需转换为:yyyy-MM-dd HH:mm:ss: return publicMethods.timeData(d.fTestdate,"1");
            //如需转换为HH:mm:ss: return publicMethods.timeData(d.fTestdate,"2");
            // 当前转换后的格式为yyyy-MM-dd: return publicMethods.timeData(d.fTestdate);
            , {
            field: 'fTestdate', title: '试验日期',  sortname: 'f_testdate',minWidth:'110',templet: function (d) {
                return publicMethods.timeData(d.fTestdate);
            }
            , hide: true
        }
            , {field: 'fLaunchstatus', title: '发射情况',  sortname: 'f_launchstatus', hide: true,minWidth:'110'}
            , {field: 'fFlighttestproblems', title: '飞行试验问题数',  sortname: 'f_flighttestproblems', hide: true,minWidth:'110'}
            , {field: 'fExclusionbasis', title: '剔除依据', sortname: 'f_exclusionbasis', hide: true,minWidth:'110'}
            , {field: 'fFailurereason', title: '失利原因',  sortname: 'f_failurereason', hide: true,minWidth:'110'}
            // , {field: 'fAward', title: '是否进行奖励', sort: true, sortname: 'f_award', hide: true}
            // , {field: 'fType', title: '类别', sort: true, sortname: 'f_type', hide: true}
            // , {field: 'fTotalmoney', title: '总金额', sort: true, sortname: 'f_totalmoney', hide: true}
            // , {field: 'fAwardreason', title: '奖励原因', sort: true, sortname: 'f_awardreason', hide: true}
            // , {field: 'belongdeptname', title: '所属单位', sort: true, sortname: 'f_belongdeptname', hide: true}
            // , {field: 'fIdentification', title: '认定情况', sort: true, sortname: 'f_identification', hide: true}
            /*, {field: 'tenantId', title: '租户Id', sort: true, sortname: 'tenantid', hide: true}
            , {field: 'fCreateby', title: '创建人', sort: true, sortname: 'f_createby', hide: true}*/
            //如需转换为:yyyy-MM-dd HH:mm:ss: return publicMethods.timeData(d.fCreatetime,"1");
            //如需转换为HH:mm:ss: return publicMethods.timeData(d.fCreatetime,"2");
            // 当前转换后的格式为yyyy-MM-dd: return publicMethods.timeData(d.fCreatetime);
            /*, {
                field: 'fCreatetime', title: '创建时间', sort: true, sortname: 'f_createtime', templet: function (d) {
                    return publicMethods.timeData(d.fCreatetime);
                }, hide: true
            }
            , {field: 'fUpdateby', title: '更新人', sort: true, sortname: 'f_updateby', hide: true}*/
            //如需转换为:yyyy-MM-dd HH:mm:ss: return publicMethods.timeData(d.fUpdatetime,"1");
            //如需转换为HH:mm:ss: return publicMethods.timeData(d.fUpdatetime,"2");
            // 当前转换后的格式为yyyy-MM-dd: return publicMethods.timeData(d.fUpdatetime);
            /*, {
                field: 'fUpdatetime', title: '更新时间', sort: true, sortname: 'f_updatetime', templet: function (d) {
                    return publicMethods.timeData(d.fUpdatetime);
                }, hide: true
            }*/
            ,{
                field: 'reportStatusStr', title: '状态', sortname: 'REPORT_STATUS', hide: false,minWidth:'110', templet: function (d) {
                    if (d.reportStatus == 18 || d.reportStatus == 10) {
                        return returnComments(d);
                    } else {
                        return d.reportStatusStr;
                    }

                }
            }
            // , {field: 'fStatus', title: ' 上报状态', sort: true, sortname: 'report_status', hide: true}
            // , {field: 'reportReason', title: '抓取失败原因', sort: true, sortname: 'f_report_reason', hide: true}
            // , {field: 'reportStatusTemp', title: '三级单位上报状态 ', sort: true, sortname: 'f_report_status_temp', hide: true}
            // , {field: 'returnmsg', title: 'returnmsg', sort: true, sortname: 'returnmsg', hide: true}
            // , {field: 'fRewardpunid', title: '质量奖惩主键', sort: true, sortname: 'f_rewardpunid', hide: true}
            , {
            width: 90,
            title: '管理',
            fixed:'right',
            toolbar: '#wQbdFlightTestRightToolsBar'
        }]

        var totalCols = [];
        totalCols = totalCols.concat(orderCols).concat(fillDeptCols).concat(commonCols);

        function returnComments(d) {
            return "<a style=\"cursor: pointer;color:red\" onclick=\"layer.open({title: '退回意见',content: '" + d.returnmsg + "'});\">" + d.reportStatusStr + "</a>";
        }

        var cols = '${cols}';

        var name = '${name}';
        var seriesName = '${seriesName}';
        var beginDate = '${beginDate}';
        var endDate = '${endDate}';
        //第一个实例
        window.tableInstace = function(tcols){
            if(tcols){
                cols = tcols;
            }
            if(cols){
                cols = JSON.parse(cols,function(k,v){
                    if(v.indexOf && v.indexOf('function') > -1){
                        return eval("(function(){return "+v+" })()")
                    }
                    return v;
                })
            }
            window.tableInstace.initCols = totalCols;
            window.tableInstace.tRender = table.render({
                elem: '#wQbdFlightTestTable'
                , height: 'full-40'
                , url: '${ctx}/qbdms/flightSuccessStatistics/showList?name='+ name + '&seriesName='+seriesName + '&beginDate=' + beginDate + '&endDate=' + endDate
                , page: true //开启分页
                , limit: 20
                 ,defaultToolbar: ['']
                , method: 'post'
                , autoSort: false //是否排序
                , cols: [cols?cols:window.tableInstace.initCols], done: function () {
                    table.resize("wQbdFlightTestTable");
                }
            });
        }
        window.tableInstace(cols);

        table.on('tool(wQbdFlightTestTable)', function (obj) {
            var data = obj.data, //获得当前行数据
                layEvent = obj.event; //获得 lay-event 对应的值
            switch (layEvent) {
                case "particulars":
                    var height=publicMethods.layHeight('body');
                    layer.open({
                        type: 2,
                        skin:'qbdms-layerFormBtn',
                        area: ['98%', height],
                        title: ['数据详情'],
                        content: '${ctx}/qbdms/wQbdFlightTest/view/particulars?id=' + data.id + '&statisticsIsClose=true',
                        success:function (layero, index) {
                            publicMethods.tipsAuto(layero.find('.layui-layer-setwin'),'点击这里关闭弹框哦',2000)
                        }
                    });
                    break;
            }
        });
    });
</script>
</body>
</html>